﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace AgvSystem.Web.Lock_Card_Info
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(!PageValidate.IsNumber(txtId.Text))
			{
				strErr+="Id格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtLock_Card_Num.Text))
			{
				strErr+="Lock_Card_Num格式错误！\\n";	
			}
			if(!PageValidate.IsNumber(txtCard_Num.Text))
			{
				strErr+="Card_Num格式错误！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			int Id=int.Parse(this.txtId.Text);
			int Lock_Card_Num=int.Parse(this.txtLock_Card_Num.Text);
			bool Is_Locked=this.chkIs_Locked.Checked;
			int Card_Num=int.Parse(this.txtCard_Num.Text);

			AgvSystem.Model.Lock_Card_Info model=new AgvSystem.Model.Lock_Card_Info();
			model.Id=Id;
			model.Lock_Card_Num=Lock_Card_Num;
			model.Is_Locked=Is_Locked;
			model.Card_Num=Card_Num;

			AgvSystem.BLL.Lock_Card_Info bll=new AgvSystem.BLL.Lock_Card_Info();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
